﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=1">
    <meta name="format-detection" content="telephone=no">
    <meta charset="UTF-8">
    <title>vue事件</title>
    <link rel="stylesheet" href="../css/bootstrap.css"/>
    <script src="../js/jquery-2.2.0.min.js"></script>
    <script src="../js/bootstrap.min.js"></script>
</head>
<body>
    <h1>vue事件</h1><br/>

    <div id="app">
        {{name}}
        <div @click="parent">parent
            <div @click="child">child
                <div @click.stop="grandson">grandson

                </div>
            </div>
        </div>
        <p>.stop阻止冒泡----停止事件传播向下往上都停止</p>
        <p>.capture捕获----意思是先低级，然后再从最里层往上冒</p>
        <p>.once表示只触发一次</p>
        <p>.self只有点击自己的时候才触发</p>
        <p>.prevent类似于在href里写上javascript:void(0)</p>
        <p>
            &lt;a href="http://www.baidu.com" @click.prevent="parent">a标签/&lt;a>
        </p>
    </div>
<script src="../js/vue-2.5.16.js"></script>
<script src="../node_modules/axios/dist/axios.js"></script>
<script src="../node_modules/lodash/lodash.js"></script>

<script>
    var app = new Vue({
        el:'#app',
        data:{
            name:'模版数据'
        },
        methods:{
            parent(){
                console.log('parent');
            },
            child(){
                console.log('child');
            },
            grandson(){
                console.log('grandson');
            }
        }
    });
</script>

</body>
</html>